package com.qf.service.impl;

import com.qf.dao.ClinicinfoRepository;
import com.qf.pojo.Clinicinfo;
import com.qf.service.ClinicinfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author H
 * @create 2020-10-12 19:53
 * @Description:
 */
@Service
public class ClinicinfoServiceImpl implements ClinicinfoService {
    @Autowired
    ClinicinfoRepository clubinfoRepository;

    //查询
    @Override
    public List<Clinicinfo> findAll() {
        return clubinfoRepository.findAll();
    }

    //根据ID
    @Override
    public Clinicinfo findById(Integer id) {

        return clubinfoRepository.findById(id).get();
    }

    //更新或增加
    @Override
    public String saveOrUpdate(Clinicinfo clinicinfo) {
        Clinicinfo clinicing = clubinfoRepository.saveAndFlush(clinicinfo);
        if (clinicing == null) {
            return "成功";
        } else {
            return "失败";
        }

    }
}
